home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 46
/
046.d81
/
one for one
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
7KB
|
254 lines
10 poke53280,0:poke53281,0:printchr$(142)"[147]":clr
15 cl$=" "
20 s=54272:forl=0to24:pokes+l,3:nextl
30 dimpc(30),pc$(30),cc(30),cc$(30),pt(30),ct(30)
40 ta=14:co=1:gosub930
50 print"[145][145][145][145][145][145][145]"tab(ta+2)"o n e"
60 print""tab(ta+3)"for"
70 print""tab(ta+3)"one[146]"
80 fora=1to40:print"[158][192]";:nexta:print
90 print"[145]created and designed by:jeff babuschak"
100 fora=1to40:print"[158][192]";:nexta:print
110 printtab(6)"press the spacebar[146] to begin":open1,0
115 print" press q to quit"
120 geta$:ifa$=""then120
130 ifa$=" "then150
135 ifa$="q"then60000
140 goto120
150 print"[147][158]"tab(8)"stack"tab(21)"card in play"
160 cn=1:nc=1:ta=6:co=1:gosub930
170 print"[145][145][145][145][145][145][145]"tab(ta+2)" one"
180 print""tab(ta+3)"for"
190 print""tab(ta+3)"one[146]"
200 print:print
210 fora=1to39:print"[192]";:nexta:print
220 rem *** main routine ***
230 print"":ta=23:c=1:gosub370:ifpc(1)>9then230
240 co=pt(1):cc=co:gosub930:nc=1:cp=pc(1)
250 print"one moment - shuffling cards[145]"
260 forzz=1to7:nc=zz:cn=zz:gosub370:nc=zz:cn=zz:gosub630:gosub2310:nextzz
270 gosub2100
280 printtab(13)"[145]dealing cards[146]"
290 ifcn=1thenprinttab(9)"[145]the computer has one card [146]":gosub3000
300 cr=0:ifcn=0ornc=0then2210
310 gosub1060:gosub2160
320 gosub2100
330 fora=1tonc:ifpt(a)=ccorpc(a)=13orpc(a)=14orpc(a)=cpthen1300
340 nexta
350 printtab(12)"[145]you must draw a card[146]":fort=1to1000:nextt:gosub2100
360 nc=nc+1:gosub370:gosub2160:goto1630
370 rem *** player get card ***
380 du=0:pc(nc)=int(0+rnd(1)*15):pt(nc)=int(10+rnd(1)*4):gosub1060
390 ifpc(nc)=0then430
400 ifpc(nc)=13orpc(nc)=14thenpt(nc)=12:goto570
410 goto490
420 rem *** check # of zero cards ***
430 fora=1tonc:ifpc(a)=pc(nc)andpt(a)=pt(nc)thendu=du+1
440 ifpc(a)=cc(nc)andpt(a)=ct(nc)thendu=du+1
450 ifpc(a)=ccthendu=du+1
460 nexta
470 ifdu>1then380
480 goto890
490 rem *** check # of reg. cards ***
500 fora=1tonc:ifpc(a)=pc(nc)andpt(a)=pt(nc)thendu=du+1
510 ifpc(a)=cc(nc)andpt(a)=ct(nc)thendu=du+1
520 ifpc(a)=ccthendu=du+1
530 nexta
540 ifdu>2then380
550 goto890
560 rem *** check # of wild cards ***
570 fora=1tonc:ifpc(a)=pc(nc)andpt(a)=pt(nc)thendu=du+1
580 ifpc(a)=cc(nc)andpt(a)=ct(nc)thendu=du+1
590 ifpc(a)=ccthendu=du+1
600 nexta
610 ifdu>4then380
620 goto890
630 rem *** computer get card ***
640 du=0:cc(cn)=int(0+rnd(1)*15):ct(cn)=int(10+rnd(1)*4):gosub1190
650 ifcc(cn)=0then690
660 ifcc(cn)=13orcc(cn)=14thenct(cn)=12:goto830
670 goto750
680 rem *** check # of zero cards ***
690 fora=1tocn:ifcc(a)=pc(cn)andct(a)=pt(cn)thendu=du+1
700 ifcc(a)=cc(cn)andct(a)=ct(cn)thendu=du+1
710 ifcc(a)=ccthendu=du+1
720 nexta
730 ifdu>1then640
740 goto910
750 rem *** check # of reg. cards ***
760 fora=1tocn:ifcc(a)=cc(cn)andct(a)=ct(cn)thendu=du+1
770 ifcc(a)=pc(cn)andct(a)=pt(cn)thendu=du+1
780 ifcc(a)=ccthendu=du+1
790 nexta
800 ifdu>2then640
810 goto910
820 rem *** check # of wild cards ***
830 fora=1tocn:ifcc(a)=cc(cn)andct(a)=ct(cn)thendu=du+1
840 ifcc(a)=pc(cn)andct(a)=pt(cn)thendu=du+1
850 ifcc(a)=ccthendu=du+1
860 nexta
870 ifdu>4then640
880 goto910
890 rem *** assign player ***
900 du=0:gosub1060:return
910 rem *** assign computer ***
920 du=0:gosub1190:return
930 rem *** draw card ***
940 poke646,co:pc$(0)="[169] "
950 printtab(ta)"[213][192][192][192][192][192][192][192][201]"
960 ifcr<>1thenprinttab(ta)"[221]";mid$(pc$(c),1,3)" [223][146] [221]"
970 ifcr=1thenprinttab(ta)"[221]";mid$(cc$(c),1,3)" [223][146] [221]"
980 printtab(ta)"[221] [223][146][221]"
990 printtab(ta)"[221] [146][221]"
1000 printtab(ta)"[221] [146][221]"
1010 printtab(ta)"[221] [146][221]"
1020 printtab(ta)"[221][223] [146][221]"
1030 printtab(ta)"[221] [223] [146][169][221]"
1040 printtab(ta)"[202][192][192][192][192][192][192][192][203]"
1050 return
1060 rem *** assign values ***
1070 fora=1tonc
1080 ifpc(a)=>0andpc(a)<=9thenpc$(a)=right$(str$(pc(a)),1)+" "
1090 ifpt(a)=10thenpt(a)=6
1100 ifpt(a)=11thenpt(a)=5
1110 ifpt(a)=12thenpt(a)=2
1120 ifpt(a)=13thenpt(a)=7
1130 ifpc(a)=10thenpc$(a)="d2"
1140 ifpc(a)=11thenpc$(a)="re"
1150 ifpc(a)=12thenpc$(a)="sk"
1160 ifpc(a)=13thenpc$(a)="wi":pt(a)=12
1170 ifpc(a)=14thenpc$(a)="w4":pt(a)=12
1180 nexta:return
1190 fora=1tocn:ifcc(a)=>0andcc(a)<=9thencc$(a)=right$(str$(cc(a)),1)+" "
1200 ifct(a)=10thenct(a)=6
1210 ifct(a)=11thenct(a)=5
1220 ifct(a)=12thenct(a)=2
1230 ifct(a)=13thenct(a)=7
1240 ifcc(a)=10thencc$(a)="d2"
1250 ifcc(a)=11thencc$(a)="re"
1260 ifcc(a)=12thencc$(a)="sk"
1270 ifcc(a)=13thencc$(a)="wi":ct(a)=12
1280 ifcc(a)=14thencc$(a)="w4":ct(a)=12
1290 nexta:return
1300 rem *** player's routine ***
1310 print"[145]"tab(7)"put cursor on card to play[146]":lo=1545:c=1
1320 uc=peek(lo):pokelo,160:fort=1to100:nextt
1330 pokelo,uc:fort=1to100:nextt
1340 getk$:ifk$=""then1320
1350 ifk$="[145]"andlo>1585thenpokelo,uc:lo=lo-80:c=c-11:goto1320
1360 ifk$=""andpeek(lo+80)<>160thenpokelo,uc:lo=lo+80:c=c+11:goto1320
1370 ifk$="[157]"andpeek(lo-3)<>32thenpokelo,uc:lo=lo-3:c=c-1:goto1320
1380 ifk$=""andpeek(lo+3)<>160thenpokelo,uc:lo=lo+3:c=c+1:goto1320
1390 ifk$=chr$(13)then1410
1400 goto1320
1410 ifpt(c)=ccorpc(c)=cporpc(c)=13orpc(c)=14thenta=23:cc=pt(c):cp=pc(c)
1420 ifpt(c)=ccorpc(c)=cporpc(c)=13orpc(c)=14thenprint"":goto1450
1430 print"[145]"tab(6)"that card can not be laid down[146]":fort=1to500:nextt
1440 gosub2100:goto1310
1450 co=cc:gosub930
1460 ifpc(c)=13orpc(c)=14thengosub2100:gosub3100
1470 ifpc(c)<>13andpc(c)<>14then1530
1480 input#1,c$:ok=.
1485 ifleft$(c$,1)="b"thencc=6:co=cc:cp=pc(c):ta=23:print"":gosub930:ok=-1
1490 ifleft$(c$,1)="g"thencc=5:co=cc:ta=23:cp=pc(c):print"":gosub930:ok=-1
1500 ifleft$(c$,1)="r"thencc=2:co=cc:ta=23:cp=pc(c):print"":gosub930:ok=-1
1510 ifleft$(c$,1)="y"thencc=7:cp=pc(c):ta=23:print"":co=cc:gosub930:ok=-1
1520 ifnot(ok)thengosub3200
1530 ifpc(c)=14thengosub3300
1540 ifpc(c)=14thenforx=1to4:cn=cn+1:gosub630:nextx
1550 ifpc(c)=10thengosub3400
1560 ifpc(c)=10thencn=cn+1:gosub630:cn=cn+1:gosub630
1570 ifpc(c)=10orpc(c)=11orpc(c)=12orpc(c)=14thenpl=1
1580 fora=ctonc:pc(a)=pc(a+1):pt(a)=pt(a+1):nexta:nc=nc-1:gosub1060
1590 ifnc=0orcn=0then2210
1600 gosub2130:gosub2100
1610 ifpl=1thenpl=0:c=1:goto290
1620 gosub2160
1630 rem *** computer's routine ***
1640 ifcp=>0andcp<10andcr=1then290
1650 ifcp=13andcr=1then290
1660 gosub1190:gosub2100
1665 d2=0:wi=0:w4=0:t2=0:cl=0:sc=0:b=0:g=0:r=0:y=0:cr=1:gc=0
1670 printtab(8)"[145]it is the computer's turn[146]"
1675 fort=1to1000:nextt:gosub2100
1680 ifcn=1thenprinttab(9)"[145]the computer has one card [146]":gosub3500
1690 fora=1tocn:ifcc(a)=10andct(a)=ccorcc(a)=cpthend2=a
1700 ifcc(a)=13thenwi=a
1710 ifcc(a)=14thenw4=a
1720 ifcc(a)=11andct(a)=ccthent2=a
1730 ifcc(a)=12andct(a)=ccthent2=a
1740 ifcc(a)=11andcc(a)=cpthent2=a
1750 ifcc(a)=12andcc(a)=cpthent2=a
1760 ifcc(a)=cporct(a)=ccthencl=a
1770 ifct(a)=ccthensc=a
1780 ifct(a)=6thenb=b+1
1790 ifct(a)=5theng=g+1
1800 ifct(a)=2thenr=r+1
1810 ifct(a)=7theny=y+1
1820 nexta
1830 ifb=>gandb=>randb=>ythengc=6
1840 ifg=>bandg=>randg=>ythengc=5
1850 ifr=>bandr=>gandr=>ythengc=2
1860 ify=>bandy=>gandy=>rthengc=7
1870 ift2<>0thena=t2:gosub1960:goto1630
1880 ifw4<>0andsc=0andnc<3thena=w4:ct(a)=gc:gosub1960:goto1630
1890 ifd2<>0thena=d2:gosub1960:goto1630
1900 ifcl<>0andnc<>1thena=cl:gosub1960:goto290
1910 ifwi<>0thena=wi:ct(a)=gc:gosub1960:goto290
1920 ifw4<>0andsc=0thena=w4:ct(a)=gc:gosub1960:goto1630
1930 ifcl<>0thena=cl:gosub1960:goto290
1940 printtab(6)"[145]the computer must draw a card":fort=1to500:nextt
1950 cn=cn+1:gosub630:gosub2100:gosub1190:goto290
1960 rem *** com. lay down card **
1970 ifct(a)=12thenct(a)=gc
1980 co=ct(a):cp=cc(a):cc=co:cn=cn-1:c=a:ta=23:print"":cr=1:gosub930
1990 ifcc(a)=14thenprinttab(8)"you must draw four cards[146]":gosub3600
2000 ifcc(a)=10thenprinttab(8)"you must draw two cards[146]":gosub3600
2010 ff=a
2020 ifcc(a)=14thenforx=1to4:nc=nc+1:gosub370:nextx:gosub1060:gosub2160
2030 a=ff
2040 ifcc(a)=10thenforx=1to2:nc=nc+1:gosub370:nextx:gosub1060:gosub2160
2050 a=ff
2060 forz=atocn:cc(z)=cc(z+1):ct(z)=ct(z+1):nextz:gosub1190
2070 gosub2100:a=ff